--
-- Created by IntelliJ IDEA.
-- User: 13911
-- Date: 2019/7/1
-- Time: 18:24
-- To change this template use File | Settings | File Templates.
--

local socket = require("socket.core")
local udp = socket.udp()
local host = host or '127.0.0.1'
local port = '8800'
udp:settimeout(4)
function rec_msg()
    local recudp = udp:receive()
    if(recudp) then
        print('recudp data:'..recudp)
    else
        print('recudp data nil')
    end
end
while 1 do
    udp:setpeername(host, port)
    local udpsend = udp:send('hello 111111111')
    if(udpsend) then
        print('udpsend ok')
        rec_msg()
        break
    else
        print('udpsend err')
    end
end
udp:close()




